package springboot.hello.helloSpringboot.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.core.annotation.Order;
import springboot.hello.helloSpringboot.entity.Hoslist;
import springboot.hello.helloSpringboot.entity.Orlist;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {

//插入申请挂号及记录
    @Insert("INSERT INTO registrationForm( UNAME,USEX,UAGE,UPHONE,UADDRESS,UHOSPITAL,UCATEGORY,UDATE) VALUES(#{uname}, #{usex}, #{uage}, #{uphone}, #{uaddress}, #{uhospital}, #{ucategory}, #{udate})")
    int insertRegistrationForm(@Param("uname") String uname, @Param("usex") String usex,@Param("uage") Integer uage,@Param("uphone") String uphone,@Param("uaddress") String uaddress,@Param("uhospital") String uhospital,@Param("ucategory") String ucategory,@Param("udate") String udate);

// 插入申请住院记录
    @Insert("INSERT INTO hospitalizationForm( HOSPITALNAME,HSEX,HAGE,HPHONE,HADDRESS,HHOSPITAL,HCATEGORY,HDATE) VALUES(#{hospitalname}, #{hsex}, #{hage}, #{hphone}, #{haddress}, #{hhospital}, #{hcategory}, #{hdate})")
    int insertHospitalizationForm(@Param("hospitalname") String hospitalname, @Param("hsex") String hsex,@Param("hage") Integer hage,@Param("hphone") String hphone,@Param("haddress") String haddress,@Param("hhospital") String hhospital,@Param("hcategory") String hcategory,@Param("hdate") String hdate);

//    显示用户最后一条挂号记录
    @Select("SELECT * FROM registrationForm ORDER BY uid DESC LIMIT 1")
    RegistrationForm findRegistrationForm();

//显示用户最后一条住院记录
    @Select("SELECT * FROM hospitalizationForm ORDER BY hid DESC LIMIT 1")
    HospitalizationForm findHospitalizationForm();

}
